// 一个返回当前日期指定格式的函数  如 2022-10-22 15:05:34 
export default function getSelectTime(selectTime: string | number | Date):string {
    let time = new Date(selectTime);  //获取当前日期
    let year: number = time.getFullYear();
    let month: string|number = time.getMonth() + 1;
    let day: string|number  = time.getDate();
    let hours: string|number  = time.getHours();
    
    let mintues: string|number  = time.getMinutes();
    let seconds: string|number  = time.getSeconds();
  
    month > 9 ? month = month : month = `0${month}`     //月不足10，补0 
    day > 9 ? day = day : day = `0${day}`
    mintues > 9 ? mintues = mintues : mintues = `0${mintues}`
    hours > 9 ? hours = hours : hours = `0${hours}`
    seconds > 9 ? seconds = seconds : seconds = '0' + seconds
  
    let result = `${year}-${month}-${day} ${hours}:${mintues}:${seconds}`;
    return result;
  }
  